const requestUrl = require('../../../config').requestUrl
//API 操作
let serviceData = require('../../../datas/service.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {

    optdate: '',
    formatDate:'',
    articletitle:'',
    resultGzhArr:[],
 
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    let optdate = options.optdate || this.data.optdate;
    let articletitle = options.articletitle || this.data.articletitle;

    this.setData({
      optdate: optdate,
      articletitle: articletitle
    })

    this.GeArticleGzhArrCount(optdate, articletitle);

  },



  //获取公众号列表
  GeArticleGzhArrCount: function (optdate, articletitle) {

    var self = this

    let param = {
      API_URL: requestUrl + "interArticleSingle.action",
      data: {
        "ref_date": optdate,
        "title": articletitle,
        "organName": wx.getStorageSync("OrganName")
      }
    };

    console.log(param);
    serviceData.result(param).then(data => {

      console.log('接口GeArticleGzhArrCount请求成功');
      console.log(data);

      this.setData({
        formatDate: data.data.ref_date_format,
        resultGzhArr: data.data.result,
      })

    }).catch(e => {
      console.log(e)
    })
  },


});

